package cn.cool.util;

import cn.cool.common.CdCheckResult;

public class CdLogicCheckUtil {

    private static final boolean CONST_SUCC = true;
    private static final boolean CONST_FAIL = false;

    public static CdCheckResult checkKey(String key, String value) {
        if (CdUtil.isStrEmpty(key) || key.indexOf(CdConstant.CONST_SYMBOL_POINT) < 1) {
            return new CdCheckResult(CONST_FAIL);
        }

        String[] keyArr = key.split("\\" + CdConstant.CONST_SYMBOL_POINT);
        if (keyArr.length != 3 || CdUtil.isStrEmpty(value)) {
            return new CdCheckResult(CONST_FAIL);
        }

        String[] valueArr = value.split("\\" + CdConstant.CONST_SYMBOL_POINT);
        return new CdCheckResult(keyArr, valueArr);
    }

}
